//
//  UserCell.swift
//  ContactListDemo
//
//  Created by dengwei on 16/5/30.
//  Copyright © 2016年 dengwei. All rights reserved.
//

import UIKit
let oceanim_friends_cell_heigth:CGFloat! = 50

class UserCell: UITableViewCell {
    
    var contact_name_lab:UILabel!
    var contact_status_btn:UIButton!
    var contact_mobile: UILabel!
    var contact_img_w_h:CGFloat! = 50
    
    var userModel:UserModel!
    var contactViewController:ViewController!
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.contact_name_lab = UILabel(frame: CGRectMake(20, (oceanim_friends_cell_heigth - 20) / 2, CGRectGetWidth(self.bounds) - self.contact_img_w_h - 66, 20))
        self.contact_name_lab?.font = UIFont.boldSystemFontOfSize(20)
        self.contact_name_lab?.text = "用户名字"
        self.contact_name_lab?.textColor = UIColor.blackColor()
        
        self.contact_mobile = UILabel(frame: CGRectMake(CGRectGetMaxX(contact_name_lab.frame) + 10, (oceanim_friends_cell_heigth - 20) / 2,180,20))
        self.contact_mobile?.font = UIFont.systemFontOfSize(14)
        self.contact_mobile?.text = ""
        self.contact_mobile?.textColor = UIColor.blackColor()
        
        self.addSubview(self.contact_name_lab)
        self.addSubview(self.contact_mobile)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    /**
     * 用户所属状态<br>
     *
     * 我的好友         1<br>
     * 对我发出邀请的    2<br>
     * 我发出好友邀请的  3<br>
     * 未知            4<br>
     * 手机号好友       5<br>
     * 群聊            10<br>
     */
    func configContact(user:UserModel!,contactViewController:ViewController!){
        
        self.contactViewController = contactViewController
        self.contact_name_lab.text = user.userName
        self.contact_mobile.text = user.userMobile
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
    }
    
}
